#!/usr/bin/python
#coding: utf-8 


import sys
from seg import Analysis
import pdb

def cuttest(text):
    #cut =  Analysis(text)
    #Analysis 中有一个__itertor__函数，里面的yield是一个generator，会生成循环被获取的东西
    wlist = [word for word in Analysis(text)]
    tmp = ""
    for w in wlist:
        tmp += w
    print tmp
    print "================================"
        
if __name__=="__main__":
    
    if (len(sys.argv) < 2):
        print("usage: python  main.py  [testTextFile]")
        exit()
    
    ftest = file(sys.argv[1]) 
    for line in ftest:
        print line
#       line = line.encode('utf-8')
        line = unicode(line, 'utf-8')
#cuttest call Analysis
        cuttest(line)
